const express = require("express");
const compression = require("compression");
const path = require("path");
const fs = require("fs")

const app = express();

app.use(compression());//对传递文件做gzip的压缩处理
app.use(express.static(path.join(__dirname, "/start"))); //指明静态文件所在目录

app.get("/", (req, res) => {
    let fileContent = fs.readFileSync(path.join(__dirname, "/start/index.html"));
    res.writeHead(200, {"Content-Type": "text/html"});
    res.end(fileContent);
})

// app.get("/", (req, res) => {
//     res.send("hello express");
// })

app.listen(8081);


